解决apache 启动之后浏览器无法访问的问题 您所在的位置:网站首页 apache安装不了 拒绝访问 解决apache 启动之后浏览器无法访问的问题

解决apache 启动之后浏览器无法访问的问题

2023-08-07 03:14| 来源: 网络整理| 查看: 265

1.首先查看httpd的状态 [xxx@xx ~]$ sudo service httpd status ● httpd.service - The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since 三 2021-11-10 14:42:53 CST; 2 days ago Docs: man:httpd(8) man:apachectl(8) Process: 29117 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=0/SUCCESS) Process: 20411 ExecReload=/usr/sbin/httpd $OPTIONS -k graceful (code=exited, status=0/SUCCESS) Process: 14521 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE) Main PID: 14521 (code=exited, status=1/FAILURE) 11月 10 14:42:52 xx.xx.xx.cn systemd[1]: Starting The Apache HTTP Server... 11月 10 14:42:53 xx.xx.xx.cn systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE 11月 10 14:42:53 xx.xx.xx.cn systemd[1]: Failed to start The Apache HTTP Server. 11月 10 14:42:53 xx.xx.xx.cn systemd[1]: Unit httpd.service entered failed state. 11月 10 14:42:53 xx.xx.xx.cn systemd[1]: httpd.service failed.

如果返回Active: failed 那就说明httpd启动失败了 可以用以下命令查看更详细的log

journalctl -xe //或者直接查看httpd的日志文件(需要root权限) sudo su tail -f -n 500 /var/log/httpd/error_log

如果返回Active: active (running) 说明apache没啥问题,直接检查下一项

2.如果项目还用了nginx,就看看nginx是不是启动了

和上面的一样

sudo su service nginx status //查看nginx状态 tail -f -n 500 /var/log/nginx/error.log //查看error log 3.查看防火墙有没有开启(RHEL7) sudo su service firewalld status //查看firewalld状态

如果开启了的话(Active: active (running)) 需要看看端口有没有暴露出去(firewall-cmd 命令)

简单粗暴方法 直接禁用防火墙 先确定是不是防火墙问题

此外可以使用 iptables -L 命令查看防火墙策略 看有没有限制访问什么的

4.查看selinux状态 如果是开启状态可以临时禁用 [root@api httpd]# getenforce //查看selinux状态 Enforcing

如果返回不是Disabled的话说明是enable的 可以直接禁用看看是不是这个问题



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有